/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import connectivity.QueryManager;
import java.util.Date;
import javax.swing.JOptionPane;
import main.BarApplication;

/**
 * Deze klasse instantieerd het object en definieerd (meestal) 2 algemene
 * methoden: getters en setters
 *
 * @author owner
 */
public class Member {

    private int memberId;
    private String firstname;
    private String middlename;
    private String lastname;
    private String gender;
    private String birthday;
    private String address;
    private String zip_code;
    private String residence;
    private String telephoneNumber;
    private String mobilePhone;
    private String email;
    private String bankAccount;
    private String password;
    private int vestigingID;
    private int abonnement;
    private boolean status;

    public Member(
            int memberId,
            String firstname,
            String middlename,
            String lastname,
            String gender,
            String birthday,
            String address,
            String zip_code,
            String residence,
            String telephoneNumber,
            String mobilePhone,
            String email,
            String bankAccount,
            String password,
            int vestigingID,
            int abonnement,
            boolean status) {
        this.memberId = memberId;
        this.firstname = firstname;
        this.middlename = middlename;
        this.lastname = lastname;
        this.gender = gender;
        this.birthday = birthday;
        this.address = address;
        this.zip_code = zip_code;
        this.residence = residence;
        this.telephoneNumber = telephoneNumber;
        this.mobilePhone = mobilePhone;
        this.email = email;
        this.bankAccount = bankAccount;
        this.password = password;
        this.vestigingID = vestigingID;
        this.abonnement = abonnement;
        this.status = status;
    }

    public Member() {
        this.memberId = -1;
    }

    public Member(int memberId) {
        this.memberId = memberId;
    }

    public Member(int memberId, String firstname, String middlename, String lastname) {
        this.memberId = memberId;
        this.firstname = firstname;
        this.middlename = middlename;
        this.lastname = lastname;
    }

    // Haalt de hoogst member ID plus 1 op voor een nieuw lid.
    public int getNewMemberID() {

        QueryManager queryManager = BarApplication.getQueryManager();
        return queryManager.getNewMemberID();
    }


    public void update() {
        QueryManager queryManager = BarApplication.getQueryManager();
        queryManager.updateMember(this);
    }

    public void insert() {
        QueryManager queryManager = BarApplication.getQueryManager();
        queryManager.setMember(this);
    }

    public void IsEmpty(String value, String messageIfEmpty) {
        if ((value == null) || (value.equals(""))) {
            //System.out.println(messageIfEmpty);
            //JOptionPane.showMessageDialog("Geslacht is niet geselecteerd", "Geslacht", JOptionPane.ERROR_MESSAGE);
        }
    }

    public int getMemberId() {
        return memberId;
    }

    public void setMemberId(int memberId) {
        this.memberId = memberId;
    }

    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public String getMiddlename() {
        return middlename;
    }

    public void setMiddlename(String middlename) {
        this.middlename = middlename;
    }

    public String getLastname() {
        return lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getZip_code() {
        return zip_code;
    }

    public void setZip_code(String zip_code) {
        this.zip_code = zip_code;
    }

    public String getResidence() {
        return residence;
    }

    public void setResidence(String residence) {
        this.residence = residence;
    }

    public String getTelephoneNumber() {
        return telephoneNumber;
    }

    public void setTelephoneNumber(String telephoneNumber) {
        this.telephoneNumber = telephoneNumber;
    }

    public String getMobilePhone() {
        return mobilePhone;
    }

    public void setMobilePhone(String mobilePhone) {
        this.mobilePhone = mobilePhone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getBankAccount() {
        return bankAccount;
    }

    public int getVestigingID() {
        return vestigingID;
    }

    public int getAbonnement() {
        return abonnement;
    }

    public void setBankAccount(String bankAccount) {
        this.bankAccount = bankAccount;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setVestigingID(int vestigingID) {
        this.vestigingID = vestigingID;
    }

    public void setAbonnement(int abonnement) {
        this.abonnement = abonnement;
    }

    /*
     * Stelt de volledige naam van het lid samen
     * 
     * @author Robert
     * @return String met de volledige naam van het lid
     */
    public String getName() {
        String completeName;
        if (middlename == null) {
            middlename = "";
        } else {
            middlename = " " + middlename.trim();
        }

        completeName = firstname.trim() + middlename + " " + lastname.trim();
        return completeName;
    }

    public int getLidNummer() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    public boolean getStatus(){
    return status;
}
    public void setStatus(boolean status){
        this.status = status;
    }
}

